﻿using ModuleGlobalMessage.Event;
using PluginAPI.Core;
using PluginAPI.Core.Attributes;
using PluginAPI.Enums;
using PluginAPI.Events;


namespace ModuleGobalMessage
{
    public class CodeLoad
    {
        public static CodeLoad Singleton { get; set; }

        [PluginConfig] public Config Config;

        [PluginEntryPoint("12 消息聊天框", "v1.0.0", "消息聊天框", "River")]
        [PluginPriority(LoadPriority.Medium)]
        public void Load()
        {
            if (!this.Config.IsEnable) return;

            Singleton = this;

            EventManager.RegisterEvents<GlobalMessageEvent>(this.Config.IsEnable);
            Log.Info($"NWPluginAPI| 消息聊天框 | 加载");
        }

        [PluginUnload]
        public void UnLoad()
        {
            Singleton = null;
            EventManager.UnregisterEvents<GlobalMessageEvent>(this.Config.IsEnable);
        }
    }
}
